[Clipboardchange] - Event handler contains native mime types #52714
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As per the latest explainer changes, to make clipboardchange event
interop, the API should let it's clients read native clipboard mime
types using the event handler, without making any additional API calls.
To reduce the risk of fingerprinting attacks, this API intentionally omits support for exposing custom MIME types.
This CL ensures that the clipboardchange event contains native mime type
as part of event payload. Just before renderer is about to dispatch the
event (after focus check), the renderer requests the browser process for
available mime types using an existing method. The list is filtered to
only contain Chromium supported native mime types (a hard-coded list).
Considered alternative: Instead of renderer requesting for types just
before event dispatch, the browser could instead send types as part of
OnClipboardChange MOJOM call, reducing 1 mojo call. However this is not
efficient when there are multiple frames listening to the clipboard
since all the frames will try to read the available types in quick
succession which can cause performance issue.
Bug: 41442253
Change-Id: I5a0d5335c1a007f496aacbd039a59382db596904
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6511791
Reviewed-by: Dan Clark <[email protected]>
Commit-Queue: Rohan Raja <[email protected]>
Reviewed-by: Sambamurthy Bandaru <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1463867}